package com.wzy.sxcg.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wzy.common.annotation.Log;
import com.wzy.common.core.controller.BaseController;
import com.wzy.common.core.domain.AjaxResult;
import com.wzy.common.enums.BusinessType;
import com.wzy.sxcg.domain.SxcgZjbg;
import com.wzy.sxcg.service.ISxcgZjbgService;
import com.wzy.common.utils.poi.ExcelUtil;
import com.wzy.common.core.page.TableDataInfo;

/**
 * 总结报告Controller
 * 
 * @author wzy
 * @date 2025-10-21
 */
@RestController
@RequestMapping("/sxcg/zjbg")
public class SxcgZjbgController extends BaseController
{
    @Autowired
    private ISxcgZjbgService sxcgZjbgService;

    /**
     * 查询总结报告列表
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:list')")
    @GetMapping("/list")
    public TableDataInfo list(SxcgZjbg sxcgZjbg)
    {
        startPage();
        List<SxcgZjbg> list = sxcgZjbgService.selectSxcgZjbgList(sxcgZjbg);
        return getDataTable(list);
    }

    /**
     * 导出总结报告列表
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:export')")
    @Log(title = "总结报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SxcgZjbg sxcgZjbg)
    {
        List<SxcgZjbg> list = sxcgZjbgService.selectSxcgZjbgList(sxcgZjbg);
        ExcelUtil<SxcgZjbg> util = new ExcelUtil<SxcgZjbg>(SxcgZjbg.class);
        util.exportExcel(response, list, "总结报告数据");
    }

    /**
     * 获取总结报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:query')")
    @GetMapping(value = "/{zjbgId}")
    public AjaxResult getInfo(@PathVariable("zjbgId") Long zjbgId)
    {
        return success(sxcgZjbgService.selectSxcgZjbgByZjbgId(zjbgId));
    }

    /**
     * 新增总结报告
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:add')")
    @Log(title = "总结报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SxcgZjbg sxcgZjbg)
    {
        return toAjax(sxcgZjbgService.insertSxcgZjbg(sxcgZjbg));
    }

    /**
     * 修改总结报告
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:edit')")
    @Log(title = "总结报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SxcgZjbg sxcgZjbg)
    {
        return toAjax(sxcgZjbgService.updateSxcgZjbg(sxcgZjbg));
    }

    /**
     * 删除总结报告
     */
    @PreAuthorize("@ss.hasPermi('sxcg:zjbg:remove')")
    @Log(title = "总结报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zjbgIds}")
    public AjaxResult remove(@PathVariable Long[] zjbgIds)
    {
        return toAjax(sxcgZjbgService.deleteSxcgZjbgByZjbgIds(zjbgIds));
    }
}
